﻿Imports System.Configuration


Public NotInheritable Class PictureServiceSettings

    Private Sub New()

    End Sub


    Private Const DefaultFeedItemsCountKey = "DefaultFeedItemsCount"
    Private Const AuthorNameKey = "AuthorName"
    Private Const AuthorEmailKey = "AuthorEmail"
    Private Const CopyrightKey = "Copyright"


    ''' <summary>
    ''' Gets the default number of feed items to expose
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared ReadOnly Property DefaultFeedItemsCount() As Integer
        Get
            Dim result As Integer
            Dim s = GetValue(DefaultFeedItemsCountKey)

            If String.IsNullOrEmpty(s) Then Return 20

            If Not Integer.TryParse(s, result) Then Return 20

            Return result
        End Get
    End Property



    

    ''' <summary>
    '''  Gets the author name to include in the feeds
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared ReadOnly Property AuthorName() As String
        Get
            Return GetValue(AuthorNameKey)
        End Get
    End Property




    ''' <summary>
    ''' Gets the author email to include in the feeds
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared ReadOnly Property AuthorEmail() As String
        Get
            Return GetValue(AuthorEmailKey)
        End Get
    End Property




    ''' <summary>
    '''  Gets the copyright message to include in the feeds
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared ReadOnly Property Copyright() As String
        Get
            Return GetValue(CopyrightKey)
        End Get
    End Property

    Private Shared Function GetValue(ByVal keyName As String) As String
        Return ConfigurationManager.AppSettings(keyName)
    End Function

End Class
